package com.itheima.d2_byte_stream;

import java.io.File;
import java.io.FileInputStream;

/*
     目标：使用文件字节输入流一次读取完文件的全部字节。
     FileInputStream类
        public byte[] readAllBytes() throws IOException	直接将当前字节输入流对应的文件对象的字节数据装到一个字节数组返回
 */
public class FileInputStreamTest3 {
    public static void main(String[] args) throws Exception {
        FileInputStream fileInputStream=new FileInputStream("aaa.txt");
//        File file=new File("aaa.txt");
//
//        byte[] byts=new byte[(int)file.length()];
//
//        fileInputStream.read(byts);
//        System.out.println(new String(byts));

        byte[] bytes = fileInputStream.readAllBytes();
        System.out.println(new String(bytes));

        fileInputStream.close();
    }
}
